package com.unionftech.content_login.presenter

import com.unionftech.common.base.mvp.impl.BasePresenter
import com.unionftech.common.base.mvp.impl.IBaseCallBack
import com.unionftech.common.bean.ResponseResult
import com.unionftech.content_login.bean.LoginTokenInfo
import com.unionftech.content_login.bean.request.RegisterRequest
import com.unionftech.content_login.contract.RegisterContract
import com.unionftech.content_login.model.RegisterModel

class RegisterPresenter : BasePresenter<RegisterContract.IRegisterView, RegisterModel>(),
    RegisterContract.IRegisterPresenter {

    override fun unionfRegister(registerRequest: RegisterRequest) {
        getView()?.showLoading()
        val callBack = object : IBaseCallBack<ResponseResult<LoginTokenInfo>> {
            override fun onResponse(response: ResponseResult<LoginTokenInfo>) {
                getView()?.hideLoading()
                getView()?.registerResult(response)
            }
        }
        getModel().unionfRegister(registerRequest, callBack)
    }
}